{extend name="layout/detail" /}

{block name="content"}
<div class="td-content-wrap p20">
    <div class="td-content-header">
        <h1 class="main-title">编辑配置</h1>
    </div>
    <hr>
    <div class="space-20"></div>
    <form id="form_data" class="layui-form" method="post" action="{:url('save')}">
        <input type="hidden" name="opmode" value="edit">
        <input type="hidden" name="id" value="{$vo.id}">
        <div class="layui-form-item">
            <label class="layui-form-label required">配置分类：</label>
            <div class="layui-input-block w19">
                <input type="hidden" id="config_tab_id" name="config_tab_id" value="{$vo.config_tab_id}">
                <input type="text" id="config_tab_name" name="config_tab_name" placeholder="请选择配置分类" class="layui-input"
                    check="required" info="请选择配置分类" readonly="readonly" value="{$vo.config_tab_name}">
                <a class="add-on" onclick="select_config_tab();"><i class="fa fa-search"></i></a>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">分类代码：</label>
            <div class="layui-input-block w19">
                <select name="field_type" check="required" info="字段类型" td-selected="{$vo.field_type}">
                    <option></option>
                    <option value="input">文本框</option>
                    <option value="textarea">多行</option>
                    <option value="input-date">日期</option>
                    <option value="radio">单选</option>
                    <option value="checkbox">多选</option>
                    <option value="select">列表</option>
                    <option value="image-upload">单图</option>
                    <option value="image-upload-multiple">多图</option>
                    <option value="video-upload">视频</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">配置名称：</label>
            <div class="layui-input-block w19">
                <input type="text" name="name" placeholder="配置名称" class="layui-input" check="required" info="配置名称" value="{$vo.name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">配置代码：</label>
            <div class="layui-input-block w19">
                <input type="text" name="code" placeholder="配置代码" class="layui-input" check="required" info="配置代码" value="{$vo.code}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">配置说明：</label>
            <div class="layui-input-block w40">
                <input type="text" name="info" placeholder="配置说明" class="layui-input"  value="{$vo.field_info}">
            </div>
        </div>
        <hr>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <a class="layui-btn" onclick="save();">保存</a>
                <a class="layui-btn layui-btn-primary" onclick="go_return_url();">取消</a>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['form', 'ueditor', 'uploader'], function () {
        let fn = {
            select_config_tab: function () {
                popup_open("{:url('select_config_tab')}", 560, 470);
            },
            save: function () {
                send_form("form_data", "{:url('save')}", function (res) {
                    if (res.code) {
                        layer.msg(res.msg, {
                            time: 1200
                        }, function () {
                            go_return_url();
                        });
                    } else {
                        layer.msg(res.msg);
                        return false;
                    }
                });
            }
        };
        win_exp(fn);
    });
</script>
{/block}